<%@page import="com.wframe.project.jnd.rest.util.WebSession"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>

<!-- 加载系统配置信息 -->
<s:syspro/>
<s:datas/>
<c:forEach items="${ad_list}" var="ad_item" varStatus="status" >
	<c:set var="ad_top_info" value="${ad_item.dataMap}"></c:set>
	<c:if test="${ad_top_info.title=='top'||ad_top_info.title=='TOP'||ad_top_info.title=='Top'}">
		<div style="width: 100%;overflow: hidden;">
			<div style="width: 4100%;margin-left: -2000%;text-align: center;">
				<a href="${ad_top_info.url}" target="_blank">
					<img src="${fileserver }${ad_top_info.phototitle}">
				</a>
			</div>
		</div>
	</c:if>
</c:forEach>
<%if(WebSession.checkLoginStatus(session)){ %>
<div id="wrap-site">
	<div class="site-nav wid990">
		<div class="site-nav-l login fl">
			<ul>
				<li class="company-name"><%=WebSession.getWbUser(session).getComname() %></li>
				<li class="log-in"><a href="javascript:showusercenter();"><%=WebSession.getWbUser(session).getTitle() %></a></li>
				<li class="register"><a href="javascript:loginout();" class="curColor">退出</a></li>
			</ul>
		</div>
		<ul class="site-nav-r fr">
			<li><a href="${ctx }/user/home">会员中心</a></li>
			<li><a href="javascript:showmyorders();">我的订单</a></li>
			<li><a href="${ctx }/order/loginhislistnew">历史采购</a></li>
			<li><a href="${ctx }/purchasetemp/list">采购模版</a></li>
			<li class="user-service sp">
				<a href="javascript:;">客户服务 <span></span></a>
				<ul>
					<li><a href="${ctx }/info/helplist">帮助中心</a></li>
					<li><a href="${ctx }/user/PCFeedbackList">意见反馈</a></li>
				</ul>
			</li>
			<li class="wechat-shop sp">
				<a href="javascript:;">微信商城 <span></span></a>
				<div class="wechat-code">
					<img src="${webctx}/images/sidebar/sid-QR.png" alt="">
					<p>微信商城下单更优惠</p>
				</div>
			</li>
		</ul>
	</div>
</div>
<%}else{%>
<div id="wrap-site">
	<div class="site-nav wid990">
		<div class="site-nav-l fl">
			<ul>
				<li>欢迎来到${webname }！</li>
				<li class="log-in"><a class="notlogin" href="javascript:showloginpage();">请登录</a></li>
				<li class="register"><a class="unregistered" href="javascript:showregisterpage();">免费注册</a></li>
			</ul>
		</div>
		<ul class="site-nav-r fr">
			<li><a href="${ctx}/user/home">会员中心</a></li>
			<li><a href="javascript:showmyorders();">我的订单</a></li>
			<li><a href="${ctx }/order/loginhislistnew">历史采购</a></li>
			<li><a href="${ctx }/purchasetemp/list">采购模版</a></li>
			<li class="user-service sp">
				<a href="javascript:;">客户服务 <span></span></a>
				<ul>
					<li><a href="${ctx }/info/helplist">帮助中心</a></li>
					<li><a href="${ctx }/user/PCFeedbackList">意见反馈</a></li>
				</ul>
			</li>
			<li class="wechat-shop sp">
				<a href="javascript:;">微信商城 <span></span></a>
				<div class="wechat-code">
					<img src="${webctx}/images/sidebar/sid-QR.png" alt="">
					<p>微信商城下单更优惠</p>
				</div>
			</li>
		</ul>
	</div>
</div>
<%} %>
<c:forEach items="${ad_list}" var="ad_item" varStatus="status" >
	<c:set var="ad_head_info" value="${ad_item.dataMap}"></c:set>
	<c:if test="${ad_head_info.title=='head'||ad_head_info.title=='HEAD'||ad_head_info.title=='Head'}">
		<div style="width: 100%;overflow: hidden;">
			<div style="width: 4100%;margin-left: -2000%;text-align: center;">
				<a href="${ad_head_info.url}" target="_blank">
					<img src="<%=getRandomFileserver()%>${ad_head_info.phototitle}">
				</a>
			</div>
		</div>
	</c:if>
</c:forEach>
<script>
    function showloginpage(tourl){
        var curUrl="";
        if(tourl)curUrl=tourl;
        else curUrl=window.location.href;
        sessionStorage.setItem("_curUrl_",curUrl);
        window.location.href=loginUrl;
    }
    function showregisterpage(){
        window.location.href=server+"/user/showregister";
    }
    function showusercenter(){
        if($w.checkLogin(true,server+"/user/home")){
            window.location.href=server+"/user/home";
        }
    }
    function showshopcart(){
        window.location.href=server+"/order/shopcart";
    }
    function showmyorders(){
        window.location.href=server+"/order/orderlist";
    }
    function loginout(){
        $w.clearLoginUser();
        $w.httpRequest({
            url:server+"/user/loginout",
            data:{},
            ok:function(ret){
                window.location.href=ctx+"/index/home";
            }
        })
    }
    function addFavorite() {
        var url = window.location;
        var title = document.title;
        try {
            window.external.addFavorite(url, title);
        }catch (e) {
            try {
                window.sidebar.addPanel(title, url, "");
            }catch (e) {
                alert("抱歉，您所使用的浏览器无法完成此操作。\n\n加入收藏失败，请使用Ctrl+D进行添加");
            }
        }
    }
    function loadMaylike(size,fun,pno){
        var priceid=getBrowsepriceid();
        var url=apiroot+'/product/maylike?priceid='+priceid+"&pagesize="+size;
        if(pno)url+="&pageno="+pno;
        $w.httpRequest({
            url:url,
            data:{},
            ok:function(ret){
                fun(ret.Data);
            }
        })
    }
    //$(function () {
    //	$w.httpRequest({
    //        url:"/info/advertise",
    //        method:"GET",
    //		async:"false",
    //		data:{"code":"003201"},
    //		ok:function (ret) {
    //            var list = ret.Data;
    //            var str='';
    //            for(var i=0; i < list.length; i++){
    //           	str +='<div style="width: 100%;overflow: hidden;">'
    //            str +='<div style="width: 4100%;margin-left: -2000%;text-align: center;">'
    //            str +='<a href="#"><img src="list[i]"></a>'
    //            str +='</div>'
    //            str +='</div>'
    //			}
    //        }
    //	})
    //})
</script>